package cn.liufuwen.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.liufuwen.domain.Goods;
import cn.liufuwen.mapper.GoodsMapper;
import lombok.extern.java.Log;
@Log
@RestController
public class HelloWorldController {
	@Autowired
    private GoodsMapper goodsMapper;
//	@Autowired
//	private UserService userService;
    @RequestMapping("/")
    public String index(HttpSession session) {
    	List<Goods> listGoods =   goodsMapper.selectAll();
    	String goodsInfo = "";
    	for(Goods goods:listGoods)
    		goodsInfo=goodsInfo+"<br>"+ goods.getId()+"=="+goods.getGoodsName()+goods.getGoodsPrice()+"=="+goods.getGoodsStock();
    	log.info(goodsInfo);
        return "Hello World"+goodsInfo;
    	
    }
    
}